package com.ruicar.afs.cloud.afscase.approvetask.service;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruicar.afs.cloud.afscase.approvetask.condition.WaitTaskPoolCondition;
import com.ruicar.afs.cloud.afscase.approvetask.condition.WorkTaskPoolCondition;
import com.ruicar.afs.cloud.afscase.approvetask.entity.WorkTaskPool;
import com.ruicar.afs.cloud.afscase.approvetask.vo.ApproveTaskVo;
import com.ruicar.afs.cloud.afscase.approvetask.vo.CaseBaseInfoVo;
import com.ruicar.afs.cloud.afscase.approvetask.vo.NoOperateTaskVo;
import com.ruicar.afs.cloud.afscase.approvetask.vo.WaitTaskVO;
import com.ruicar.afs.cloud.afscase.infomanagement.entity.CaseBaseInfo;
import com.ruicar.afs.cloud.afscase.infomanagement.entity.CaseContractInfo;

import java.util.List;

/**
 * @author jiaqi.guo
 * @version 1.0
 * @description: 任务池service
 * @created 2020/6/20 16:27
 */
public interface WorkTaskPoolService extends IService<WorkTaskPool> {
    /**
     * 待分配任务
     */
    IPage<WaitTaskVO> getAllWaitTaskList(Page page, WaitTaskPoolCondition waitTaskPoolCondition);

    /**
     * 公共任务池
     */
    IPage<ApproveTaskVo> queryCommonPoolTaskList(Page page, WorkTaskPoolCondition workTaskPoolCondition);

    /**
     * 审批代办件
     */
    IPage<ApproveTaskVo> queryApproveTaskList(Page page, WorkTaskPoolCondition workTaskPoolCondition);

    /**
     * 组长待办件
     */
    IPage<ApproveTaskVo> queryGroupLeaderTaskList(Page page, WorkTaskPoolCondition workTaskPoolCondition);

    /**
     * 公共任务池
     */
    IPage<ApproveTaskVo> querySpecialPoolTaskList(Page page, WorkTaskPoolCondition workTaskPoolCondition);

    /**
     * 案件
     */
    IPage<CaseBaseInfoVo> queryCaseInfoTaskList(Page page, WorkTaskPoolCondition workTaskPoolCondition);

    /**
     * 锁定
     */
    Integer modifyLock(List<WaitTaskVO> waitTaskVOList, String status);

    /**
     * 置顶
     */
    Integer modifyStick(List<WaitTaskVO> waitTaskVOList, String status);

    /**
     * 通过流程编号和申请编号去查询流程对象
     *
     * @param applyNo
     * @param stageNo
     * @return
     * @author yk.Li
     */
    WorkTaskPool findByApplyAndStageNo(String applyNo, String stageNo);

    /**
     * 获取规则Json
     *
     * @param caseContractInfo
     * @return
     * @author rj.zhang
     */
    JSONObject getRuleJSONObject(CaseContractInfo caseContractInfo);

    /**
     * 根据指定状态列表和无操作时长查询无操作待办任务列表
     * */
    List<String> queryNoOperateApproveTaskList(WorkTaskPoolCondition workTaskPoolCondition);

    /**
     * 查询审批流程任务列表
     * @author ma_xueyu
     * @param applyNo 申请编号
     * */
    List<WorkTaskPool> getWorkTaskListByCondition(String applyNo,String scheduleId);

    /**
     * <p>description：</p>
     * 查询审批流程下一节点任务
     * @param applyNo 申请编号
     * @param scheduleId 流程实例表ID
     * @param approveStaff 当前节点审批员（撤回申请人）
     * @return
     * @author yk.Li
     */
    WorkTaskPool getNextWorkTaskByCondition(String applyNo, String scheduleId, String approveStaff);


    /**
     * @Description 获取当前所有常规流程任务
     * @Author Peng_Jinbo
     * @Date 2020/10/12 16:49
     */
    List<WorkTaskPool> listAllNormalFlowPool(String businessStateIn, String processType);
}
